
#ifndef LZ78_BitBuffer_h
#define LZ78_BitBuffer_h

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

struct __bitbuf;

typedef struct __bitbuf BITFILE;

BITFILE* bitfile_open(const char* filename,int mode);
int bitfile_read(BITFILE* bfp,unsigned char* dst,int nbits);
int bitfile_write(BITFILE* bfp,const unsigned char* src,int nbits);
void bit_copy(const unsigned char *src, int src_offset, unsigned char *dst, int dst_offset, int len);
int bitfile_close(BITFILE* bfp);
int bitfile_file_descriptor(BITFILE* bfd);
unsigned READ_BIT(const unsigned char *base, unsigned int i);
void WRITE_BIT(unsigned char *base, unsigned int i, int val);
int min(int x1, int x2);

#endif

